<template>
  <div id="mv">
    <div class="split">
      <div class="dot"></div>
      <span>推荐MV</span>
    </div>

    <div class="mv-box">
      <div class="item" v-for="item in mvList" :key="item.id">
        <div class="img">
          <!-- 遮罩 -->
          <div class="cover-mask">
            <div class="play-count iconfont icon-playfill">
              {{ item.playCount | filterCount }}
            </div>
            <div class="iconfont icon-playfill play-btn"></div>
          </div>
          <img v-lazy="item.picUrl" alt="cover" />
        </div>
        <div class="mv-info">
          <div class="mv-name">
            {{ item.name }}
          </div>
          <div class="mv-artists">
            {{ item.artists | filterArtists }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";

export default {
  name: "Mv",
  computed: {
    ...mapState({
      mvList: (state) => state.home.mvList,
    }),
  },
  mounted() {
    this.$store.dispatch("mvList");
  },
};
</script>

<style lang='less'>
#mv {
  margin-top: 30px;
  .split {
    display: flex;
    align-items: center;
    .dot {
      width: 5px;
      height: 22px;
      background: var(--themeColor1);
      display: inline-block;
      margin-right: 10px;
    }
    font-size: 20px;
    font-weight: bold;
    padding-left: 5px;
  }
  .mv-box {
    display: flex;
    justify-content: space-between;
    .item {
      margin-top: 20px;
      width: 24%;
      .img {
        width: 100%;
        height: 60%;
        display: flex;
        align-items: center;
        overflow: hidden;
        border-radius: 10px;
        position: relative;
        img {
          width: 100%;
        }
        // 遮罩
        .cover-mask:hover {
          opacity: 1;
          transition: 500ms;
        }
        .cover-mask {
          opacity: 0;
          cursor: pointer;
          border-radius: 10px;
          position: absolute;
          width: 100%;
          height: 100%;
          background: rgba(0, 0, 0, 0.4);
          .play-count {
            position: absolute;
            right: 10px;
            top: 10px;
            color: #fff;
            font-size: 12px;
          }
          .play-btn {
            position: absolute;
            right: 10px;
            bottom: 10px;
            color: var(--themeColor1);
            background: #fff;
            border-radius: 50%;
            padding: 5px;
          }
        }
      }
      .mv-info {
        .mv-name {
          margin-top: 10px;
          font-size: 14px;
          display: -webkit-box; /**对象作为伸缩盒子模型展示**/
          -webkit-box-orient: vertical; /**设置或检索伸缩盒子对象的子元素的排列方式**/
          -webkit-line-clamp: 1; /**显示的行数**/
          overflow: hidden; /**隐藏超出的内容**/
        }
        .mv-artists {
          margin-top: 5px;
          font-size: 12px;
          display: -webkit-box; /**对象作为伸缩盒子模型展示**/
          -webkit-box-orient: vertical; /**设置或检索伸缩盒子对象的子元素的排列方式**/
          -webkit-line-clamp: 1; /**显示的行数**/
          overflow: hidden; /**隐藏超出的内容**/
        }
      }
    }
  }
}
</style>